public class QuickSort{
    /**
     *
     * @param array
     * @param left
     * @param right
     */
    public static void sort(int[] array, int left, int right) {
        if(left>right){
            return ;
        }
        int i = left;
        int j = right;
        int temp = array[left];
        while (i!=j) {
            while (array[j] >=temp && i<j) {
                j--;
            }
            while (array[i] <= temp && i < j) {
                i++;
            }
            if (i < j) {
                int temp_arry = array[i];
                array[i] = array[j];
                array[j] = temp_arry;
            }
        }
        array[left] = array[i];
        array[i] = temp;
       
        sort(array, left, i-1);
        sort(array, i+1, right);
    }


    public static void main(String[] args) {
        int[] array = {3,6,7,2,8,1,9,0,5,4};
        sort(array, 0, 9);
        
        for(int i = 0;i<array.length;i++){
            System.out.print(array[i]);
        }
    }
}